#ifndef RPCSERVER_H
#define RPCSERVER_H

#include <map>
#include <string>

#include "os_thread.h"
#include "rpcclient.h"

class RPCServer
{
public:
	RPCServer();
	virtual ~RPCServer();

	void set_port(unsigned short port);
	void addClient(int sock, RPCClient *client);

	int startThread();
	static int ThreadProc(void *pinstance);
	virtual int run();

protected:
private:
	unsigned short m_port;
	std::map<int, RPCClient *> m_clientMap;
	os_thread_t *m_pThread;
	os_mutex_t *m_pMutex;

};


#endif // RPCSERVER_H